//
//  customSearchTableViewCell.m
//  QRMaster
//
//  Created by myApple on 15/11/2.
//  Copyright (c) 2015年 myApple. All rights reserved.
//

#import "customSearchTableViewCell.h"
#import "UIImageView+WebCache.h"

@interface customSearchTableViewCell()
{
    UILabel * firstCharLabel;
    UILabel * customNameLabel;
    UILabel * customMoblieLabel;
    UIImageView * customHeaderImgView;
}
@end

@implementation customSearchTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self prepareView];
    }
    return self;
}

-(void)prepareView
{
    float ScreenWidth = [UIScreen mainScreen].bounds.size.width;
    
    float x = 16;
    float y = 9;
    float width = 38;
    float height = 38;
    customHeaderImgView = [[UIImageView alloc]initWithFrame:CGRectMake(x, y, width, height)];
    customHeaderImgView.layer.cornerRadius = 19;
    customHeaderImgView.layer.masksToBounds = YES;
    [self.contentView addSubview:customHeaderImgView];
    
    x = 72;
    y = 9;
    width = ScreenWidth - x - 80;
    height = 16;
    customNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(x, y, width, height)];
    customNameLabel.font = [UIFont systemFontOfSize:15.0];
    customNameLabel.textColor = UIColorFromRGB(0x333333);
    [self.contentView addSubview:customNameLabel];
   
    
    y += height + 8;
    height = 14;
    width = ScreenWidth - x - 100;
    customMoblieLabel = [[UILabel alloc]initWithFrame:CGRectMake(x, y, width, height)];
    customMoblieLabel.font = [UIFont systemFontOfSize:12.0];
    customMoblieLabel.textColor = UIColorFromRGB(0x727272);
    [self.contentView addSubview:customMoblieLabel];
    
    
    
    
//    x = 0;
//    y = 15;
//    width = 40;
//    height = 30;
//    firstCharLabel = [[UILabel alloc]initWithFrame:CGRectMake(x, y, width, height)];
//    firstCharLabel.font = [UIFont systemFontOfSize:25.0];
//    firstCharLabel.textAlignment = NSTextAlignmentCenter;
//    [self.contentView addSubview:firstCharLabel];
    
    x = 0;
    y = 0;
    width = ScreenWidth;
    height = 0.5;
    UIView *ViewOfLine = [[UIView alloc]initWithFrame:CGRectMake(x, y, width, height)];
    ViewOfLine.backgroundColor = RGBA(193, 193, 193, 1);
    ViewOfLine.hidden = YES;
    [self.contentView addSubview:ViewOfLine];
}


-(void)setFirstChar:(NSString *)firstChar
{
    _firstChar = firstChar;
    firstCharLabel.text = firstChar;
}

-(void)setCustomHeadImg:(NSString *)customHeadImg
{
    _customHeadImg = customHeadImg;
    NSString * url = [NSString stringWithFormat:@"%@%@",YSBHEADERIMGURL,_customHeadImg];
    [customHeaderImgView sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:[UIImage imageNamed:@"ic_加载头像212"]];
}

-(void)setCustomMobile:(NSString *)customMobile
{
    _customMobile = customMobile;
    customMoblieLabel.text = customMobile;
}

-(void)setCustomName:(NSString *)customName
{
    _customName = customName;
    customNameLabel.text = customName;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
